package com.luobo.yfh;

import com.luobo.yfh.vo.request.RequestVo;
import com.luobo.yfh.vo.respone.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("inform")
@Api(tags = "平台提供回调接口")
public class InformController {

    @PostMapping("payment")
    @ApiOperation(value = "支付通知", response = Result.class, produces = MediaType.APPLICATION_JSON_VALUE)
    public Result payment(@RequestBody @Valid RequestVo requestVo, BindingResult bindingResult) {
        if (bindingResult.hasErrors()) {
            return Result.error();
        }
        return Result.success();
    }

    @PostMapping("invoiceInform")
    @ApiOperation(value = "专票通知", response = Result.class, produces = MediaType.APPLICATION_JSON_VALUE)
    public Result invoiceInform(@RequestBody @Valid RequestVo requestVo, BindingResult bindingResult) {
        if (bindingResult.hasErrors()) {
            return Result.error();
        }
        return Result.success();
    }


    @PostMapping("surrenderNotice")
    @ApiOperation(value = "退保通知", response = Result.class, produces = MediaType.APPLICATION_JSON_VALUE)
    public Result surrenderNotice(@RequestBody @Valid RequestVo requestVo, BindingResult bindingResult) {
        if (bindingResult.hasErrors()) {
            return Result.error();
        }
        return Result.success();
    }

}
